{extend name='index/base' /}

{block name='main'}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 合作伙伴 <span class="c-gray en">&gt;</span> 链接列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <form id="myform" action="{:url('Cooperation/indexs')}" method="get">
        标题：<input type="text" id="name" class="input-text" style="width:120px" placeholder="标题名称" value="" name="name">
            <input id="pc" type="hidden" name="p" value="">
        <button type="submit" class="btn btn-success radius"  name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        <button type="button" id="reset" class="btn btn-danger radius" > 重置</button>
        </form>
    </div>
    <div class="cl pd-5 bg-1 bk-gray "> <span class="l"><a href="javascript:;" onclick="addarticle('文章添加','{:url("admin/article/articleView")}','1200','800')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 文章添加</a></span>  </div>
    <div class="mt-20">
        <div class="dataTables_length mb-15" id="DataTables_Table_0_length">
            <!--<label>显示-->
            <!--<select name="DataTables_Table_0_length" id="p" style="width: 50px" aria-controls="DataTables_Table_0" class="select">-->

            <!--</select> 条-->
            <!--</label>-->
        </div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="25">ID</th>
                <th width="90">名称</th>
                <th width="130">图片</th>
                <th width="160">URL</th>
                <th width="100">添加时间</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name='data' id='v'}
            <tr class="text-c">
                <td><input type="checkbox" value="1" name=""></td>
                <td>{$v.id}</td>
                <td style="text-align: left"><a href="javascript:;">{$v.title}</a></td>
                <td><img src="/upload/Cooperation/{$v.photo}" alt="" width="150px" ></td>
                <td style="text-align : left">{$v.url}</td>
                <td >{$v.createtime}</td>
                <td >
                    {if condition='$v.status==0'}
                    <span class="label label-success radius"><a href="{:url('Cooperation/statue')}?id={$v.id}" style="color:white">开启</a></span>
                    {else\}
                    <span class="label label-error radius"><a href="{:url('Cooperation/statue')}?id={$v.id}"  style="color:white">关闭</a></span>
                    {/if}
                    |
                    <span class="label label-red radius"><a href="javascript:;" onclick="yq_del(this,'{$v.id}')"  style="color:white">删除</a></span>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
        {$page}
    </div>
</div>
</body>
</html>

{/block}


{block name='my'}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<!--<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>-->
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    $(function(){
//        $('.table-sort').dataTable({
//            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
//            "bStateSave": true,//状态保存
//            "aoColumnDefs": [
//                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
//                {"orderable":false,"aTargets":[]}// 制定列不参与排序
//            ]
//        });

    });
    /*用户-添加*/
    function addarticle(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*用户-查看*/
    function member_show(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*删除*/
    function yq_del(obj,id){
//        alert(id)
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '{:url("admin/Cooperation/del")}',
                data:{
                    id:id,
                },
                dataType: 'json',
                success: function(data){
                    if(data=='success'){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }



    /*资讯-编辑*/
    function article_edit(title,url,id,w,h){
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
        });
        layer.full(index);
    }
    $('#p').change(function () {
        var c=$(this).val();
        $('#pc').val(c);
        $('#myform').submit();

    })
    $('#reset').click(function () {
        $('#name').val('');
        $('#myform').submit();
    })
    /*资讯-审核*/
    function article_shenhe(obj,id){
        layer.confirm('审核文章？', {
                btn: ['通过','取消'],
                shade: false,
                closeBtn: 0
            },
            function(){
//                $(obj).parents("tr").find(".td-manage").prepend('<a class="c-primary" onClick="article_start(this,id)" href="javascript:;" title="申请上线">申请上线</a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发布</span>');
                $(obj).remove();
                layer.msg('已发布', {icon:6,time:1000});
            },
            function(){
//                $(obj).parents("tr").find(".td-manage").prepend('<a class="c-primary" onClick="article_shenqing(this,id)" href="javascript:;" title="申请上线">申请上线</a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-danger radius">未通过</span>');
                $(obj).remove();
                layer.msg('未通过', {icon:5,time:1000});
            });
    }
</script>



{/block}